# -*-coding:utf-8 -*-
from xadmin.sites import site
from django.dispatch import receiver
from xadmin.views import BaseAdminPlugin, CommAdminView, ListAdminView
from django.template import loader
from django.conf import settings
from django.urls import reverse


class SearchPlugin(BaseAdminPlugin):
    def init_request(self, *args, **kwargs):
        return True

    def get_context(self, context):
        new_context = {
            'adminsearch_url': reverse("xadmin:search_view")
        }
        context.update(new_context)
        return context


site.register_plugin(SearchPlugin, CommAdminView)
